Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API: add Source IP Block command #3211

Merged
merged 2 commits into from
Mar 31, 2024
Merged

API: add Source IP Block command #3211

merged 2 commits into from
Mar 31, 2024

Conversation

hossinasaadi
Copy link
Contributor

@hossinasaadi hossinasaadi commented Mar 30, 2024

add Source IP Block command for clients. x-ui and ...
kinda help for ip restriction.

./xray api sib --server=127.0.0.1:62789 -outbound=blocked -inbound=socks5 -reset 127.0.0.1 1.1.1.1 ...

-outbound
	route traffic to specific outbound.
-inbound
	target traffig from specific inbound. Default Empty (All inbounds)
-ruletag
	set ruleTag. Default sourceIpBlock
-reset
	remove ruletag and apply new source IPs. Default false

#1317

@yuhan6665 yuhan6665 merged commit ba57ccd into XTLS:main Mar 31, 2024
34 checks passed
@yuhan6665
Copy link
Member

Haha I almost forgot why you added the routing API. Great work!

@hossinasaadi hossinasaadi deleted the sibAPI branch March 31, 2024 04:37
@RPRX
Copy link
Member

RPRX commented Mar 31, 2024

只是问一下,似乎 #3189 也可以做到这件事?如果是的话,为此多加一项 API 的意义是?

@Fangliding
Copy link
Member

Fangliding commented Mar 31, 2024

@RPRX 方便他们的各种面板增删规则(?)
好像不少伊朗人想要灵活的限速/限制源IP/限流量这种用户控制的功能
说难听点 开机场 不过不像中国搓了xrayr和sspannel之类的一整套生态 他们好像更喜欢直接在核心上开(当然也可能是因为这部分的英文资料极度匮乏)
如果是issues大概会被直接轰走 pull request 就不好说啥了

@hossinasaadi
Copy link
Contributor Author

@Fangliding
i know about implementing custom dispatcher but a lot of panels just running Xray binary.

@RPRX yes it does. far as i checked, a lot of clients asked for such option like this, so i decided to simplifying it by adding an API.

@yuhan6665
Copy link
Member

确实从 api 设计的角度讲 应该设计成 parameterized 一个 command 解决所有问题
不过这个 pr 不修改 core 的任何文件 不增加维护成本 所以考虑到原作者需要就合了 :)

@Fangliding
Copy link
Member

比起这些麻烦您们加feature的时候把文档都同步加一下()

arror added a commit to arror/Xray-core that referenced this pull request Apr 2, 2024
* main: (24 commits)
  Add "nosni" option to send empty SNI (XTLS#3214)
  API: add Source IP Block command (XTLS#3211)
  v1.8.10
  Fix TestXrayConfig in xray_test.go
  Add separate host config for websocket
  Update proto file for websocket and httpupgrade (breaking)
  API - Add | Remove Routing Rules  (XTLS#3189)
  Fix host in headers field does not work XTLS#3191
  fix: config `burstObservatory` override
  Bump github.com/sagernet/sing from 0.3.6 to 0.3.8
  Add support for HTTPupgrade custom headers
  improve balancer_info.go
  Fix(httpupgrade): `X-Forwarded-For` header not read. (XTLS#3172)
  Allow to send through random IPv6
  Update HTTPUpgrade spelling and proto
  Chore: Clean up legacy `field` usage
  Update README.md
  Bump github.com/quic-go/quic-go from 0.41.0 to 0.42.0
  Fix HTTPUpgrade transport register
  HTTPUpgrade 0-RTT (XTLS#3152)
  ...
vrnobody pushed a commit to vrnobody/xraycore that referenced this pull request Apr 15, 2024
This reverts commit ba57ccd.

Because this commit conflict with api getr/setr.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants